import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'
export default createStore({
  state: {
    token:0,
    detail: JSON.parse(sessionStorage.getItem("DETAIL")) || {}

  },
  mutations: {
    setToken(state,t){
      state.token=t;
    },
    setDetail(state,data){
      state.detail=data;
      sessionStorage.setItem("DETAIL",JSON.stringify(data))
    }
  },
  plugins:[createPersistedState()]
})
